
CXX = g++
INCPATH = -I. -I/usr/include/ -I${SAMTOOLS_DIR}

LIBPATH = -L${SAMTOOLS_DIR}
LIBS = -lboost_serialization-mt -lboost_program_options-mt -lboost_iostreams-mt -lbam -lz


HGVERSION = 2.0.4

TYPE = release
SAMTOOLS_DIR = ../samtools-0.1.16/
# To change build type use flags on make command line. 
# e.g. make TYPE=debug

# TYPE = debug (default)
ifeq ($(TYPE),debug)
LDPARAM = 
CCPARAM = -Wall -g -pedantic -ansi -pthread -DHGVERSION="\"${HGVERSION}\""
MACROS = -DBOOST_DISABLE_ASSERTS -DCOMB_DEBUG_VERBOSE
endif

# TYPE = release
ifeq ($(TYPE), release)
LDPARAM = 
CCPARAM = -Wall -O3 -pedantic -ansi -pthread -DHGVERSION="\"${HGVERSION}\""
MACROS = -DNDEBUG -DBOOST_DISABLE_ASSERTS
endif

.PHONY: clean cleanall hg_version

OBJS = util.o perm_parser.o priors.o snp_cand.o call_rates.o snp_call.o option_parse.o consensus.o easyrun.o view.o merge.o expression.o io.o qual.o info.o sam_parser.o

TARGETS = comb 

all: $(TARGETS)

comb: comb_bin.o $(OBJS) hg_version samtools
	$(CXX) -o $@ comb_bin.o $(OBJS) $(CCPARAM) $(LDPARAM) $(LIBS) $(LIBPATH)

%.o: %.cpp
	$(CXX) $(CCPARAM) $(INCPATH) $(MACROS) -c $< -o $@

samtools:
	cd $(SAMTOOLS_DIR); make
clean:
	-rm -f *.o

cleanall: clean
	-rm -f $(TARGETS)
